/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package net.easoftware.code.beans.cargas.impl;

import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import net.easoftware.code.beans.BeanHelper;
import net.easoftware.code.beans.cargas.AsOff;
import net.easoftware.code.beans.cargas.DataFilter;
import net.easoftware.code.beans.cargas.threading.CargasFilteringThread;
import net.easoftware.code.beans.cargas.threading.Result;
import net.easoftware.code.beans.facade.LineaNegocio;
import net.easoftware.code.beans.facade.RangoEmpresaFc;
import net.easoftware.code.error.EaError;
import net.easoftware.code.mb.MbLineasNegocio;
import net.easoftware.code.mb.MbRangosEmpresa;
import org.apache.commons.collections.map.LinkedMap;

/**
 *
 * @author eliu
 */
public class VentaCAFilter implements DataFilter {

    private static List<RangoEmpresaFc> rangos = new LinkedList<RangoEmpresaFc>();
    private static Map<String, LineaNegocio> lineas = new LinkedMap();

    @Override
    public Result proccesBean(Object bean, CargasFilteringThread parent) throws EaError {
        /*  if (lineas.isEmpty()) {
         MbLineasNegocio mln = (MbLineasNegocio) BeanHelper.manualInject("mbLineasNegocio");
         for (LineaNegocio ln : mln.getLista()) {
         lineas.put(ln.getPrefijo(), ln);
         }
         }
         if (rangos.isEmpty()) {
         MbRangosEmpresa re = (MbRangosEmpresa) BeanHelper.manualInject("mbRangosEmpresa");
         rangos = re.getRangos();
         }

         AsOff aso = (AsOff) bean;
         boolean rango = false;
         boolean linea = false;

         for (RangoEmpresaFc ref : rangos) {
         if (ref.getCodigoFin() >= aso.getCompania().intValue() && ref.getCodigoInicio() <= aso.getCompania().intValue()) {
         rango = true;
         break;
         }
         }
         LineaNegocio ln = lineas.get(aso.getProducto());
         if (ln != null) {
         linea = true;
         }*/
        Result r = new Result(true, true);
        r.setCurrentBean(bean);
        return r;
    }
}
